package org.sysmhg.base.dao.hibernate;

import java.util.List;

import org.springframework.orm.ObjectRetrievalFailureException;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.sysmhg.base.dao.CompanyDAO;
import org.sysmhg.base.model.Company;
import org.sysmhg.util.Pagination;

public class CompanyDAOHibernate extends HibernateDaoSupport implements CompanyDAO{

    @SuppressWarnings("unchecked")
	public List<Company> getCompanies(Company company, Pagination paginacion) {
    	return getHibernateTemplate().find("from Company");
    }

    public Company getCompany(Company company) {
        return (Company) getHibernateTemplate().get(Company.class, company.getCompany_id());
    }

    public void createCompany(Company Company) {
        getHibernateTemplate().save(Company);
    }

    public void deleteCompany(Company company) {
    	getHibernateTemplate().delete(company);
    }

	public void updateCompany(Company Company) {
		getHibernateTemplate().update(Company);
	}
}